﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZXIMEW.DAL.Base;
using ZXIMEW.Models.DModels;

namespace ZXIMEW.DAL
{
    public class UserDAL : BaseDAL<UserInfo>
    {
        /// <summary>
        /// 登录系统，返回用户编号和状态
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public UserInfo Login(UserInfo userInfo)
        {
            string strWhere = "UserName=@userName and UserPwd=@userPwd and IsDeleted=0";
            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@userName",userInfo.UserName),
                new SqlParameter("@userPwd",userInfo.UserPwd)
            };
            return GetModel(strWhere, "UserId,UserState", paras);
        }
    }
}
